package toolkit.tianshi.common.model;

import java.io.Serializable;

/**
 * 请求结果响应类
 *
 * @param <T>
 * @author changji.zhang
 */
public class Response<T> implements Serializable {

    private static final long serialVersionUID = -6333414047319484475L;
    private boolean success = Boolean.FALSE;
    private T result;
    private String error;

    public static <T> Response<T> newResponse(){
        return new Response<T>();
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.success = Boolean.TRUE;
        this.result = result;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.success = Boolean.FALSE;
        this.error = error;
    }

}
